﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static System.Windows.Forms.MonthCalendar;

namespace sy2_1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            double radius = Convert.ToDouble(textBox1.Text);

            // 计算面积和周长（使用基本运算符）
            double area = Math.PI * radius * radius;       // 面积公式：πr²
            double circumference = 2 * Math.PI * radius;  // 周长公式：2πr

            // 显示结果，保留两位小数
            txtArea.Text = area.ToString("F2");
            txtCircumference.Text = circumference.ToString("F2");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            txtRadius.Clear();
            txtArea.Clear();
            txtCircumference.Clear();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
